//
//  OtherEvaluateViewController.m
//  wtshoppingcite
//
//  Created by TW on 14-12-12.
//  Copyright (c) 2014年 TW. All rights reserved.
//

#import "OtherEvaluateViewController.h"

@interface OtherEvaluateViewController ()<UITextFieldDelegate>

@property(nonatomic,assign)BOOL isButton1;
@property(nonatomic,assign)BOOL isButton2;
@property(nonatomic,assign)BOOL isButton3;
@property(nonatomic,assign)BOOL isButton4;
@property(nonatomic,assign)BOOL isButton5;


@property(nonatomic,assign)BOOL isButton10;
@property(nonatomic,assign)BOOL isButton20;
@property(nonatomic,assign)BOOL isButton30;
@property(nonatomic,assign)BOOL isButton40;
@property(nonatomic,assign)BOOL isButton50;


@property(nonatomic,assign)BOOL isButton200;
@property(nonatomic,assign)BOOL isButton201;
@property(nonatomic,assign)BOOL isButton202;
@property(nonatomic,assign)BOOL isButton203;
@property(nonatomic,assign)BOOL isButton204;

@end

@implementation OtherEvaluateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitleView:@"评价"];
    
    _i = 0;
    _y = 0;
    _j = 0;
    
    _isButton1 = YES;
    _isButton2 = YES;
    _isButton3 = YES;
    _isButton4 = YES;
    _isButton5 = YES;
    
    
    _isButton10 = YES;
    _isButton20 = YES;
    _isButton30 = YES;
    _isButton40 = YES;
    _isButton50 = YES;
    
    _isButton200 = YES;
    _isButton201 = YES;
    _isButton202 = YES;
    _isButton203 = YES;
    _isButton204 = YES;
    
    _myOrderItems = [[MyOrderItems alloc]initWithMyOrderItemInfo:[self.myOrderModel.orderItems objectAtIndex:0]];
    self.titleLabel.text = _myOrderItems.descp;
    self.totalCount.text  = _myOrderItems.count;
    self.priceLabel.text = _myOrderItems.salePrice;
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 120, kWidth, 138)];
    imageView.image = [UIImage imageNamed:@"evluate_paopao"];
    imageView.userInteractionEnabled = YES;
    [self.subView addSubview:imageView];
    
    [imageView addSubview:self.textField];
    
    self.textField.delegate = self;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                                          action:@selector(touchedAction)];
    [self.view addGestureRecognizer:tap];
    
    // Do any additional setup after loading the view.
}


-(void)touchedAction{
    [self.textField resignFirstResponder];
}

//发货速度
-(IBAction)sendScoreAction:(UIButton *)btn{
    
    if (btn.tag == 10 ) {
        
        if (_isButton1 ) {
            [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button11 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button12 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton1 = NO;
            _isButton2 = YES;
            _isButton3 = YES;
            _isButton4 = YES;
            _isButton5 = YES;
            
        }else{
            
            [_button10 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button11 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button12 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton1 = YES;
          
        }
        
        _i= 1;
        
    }else if (btn.tag ==11){
         if (_isButton2 ) {
             [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button12 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             
             _isButton1 = YES;
             _isButton2 = NO;
             _isButton3 = YES;
             _isButton4 = YES;
             _isButton5 = YES;
         }else{
             
             [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button11 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button12 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             
            
             _isButton2 = YES;
            
         }
        _i= 2;
        
    }else if (btn.tag ==12 ){
        
        if (_isButton3) {
            [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button12 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton1 = YES;
            _isButton2 = YES;
            _isButton3 = NO;
            _isButton4 = YES;
            _isButton5 = YES;
        }else{
            
            [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button12 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
           
            _isButton3 = YES;
            
        }
       
        _i= 3;
      
    }else if (btn.tag ==13){
        
         if (_isButton4 ) {
             [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button12 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button13 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             _isButton1 = YES;
             _isButton2 = YES;
             _isButton3 = YES;
             _isButton4 = NO;
             _isButton5 = YES;
             
         }else{
             
             [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button12 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
             [_button13 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
             
           
             _isButton4 = YES;
            
         }

        
        _i= 4;
        
        
    }else if (btn.tag ==14){
        
        if (_isButton5) {
            [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button12 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button13 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button14 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton1 = YES;
            _isButton2 = YES;
            _isButton3 = YES;
            _isButton4 = YES;
            _isButton5 = NO;
        }else{
            
            [_button10 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button11 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button12 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button13 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button14 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton5 = YES;
        }
        _i= 5;
    }
    NSLog(@"%d",_i);
}



//服务态度
-(IBAction)serviceAction:(UIButton *)sender{
    
    if (sender.tag == 100 ) {
        
        if (_isButton10 ) {
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton10 = NO;
            _isButton20 = YES;
            _isButton30 = YES;
            _isButton40 = YES;
            _isButton50 = YES;
            
        }else{
            
            [_button100 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton10 = YES;
        }
        
        _j= 1;
        
    }else if (sender.tag ==101){
        if (_isButton20 ) {
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton10 = YES;
            _isButton20 = NO;
            _isButton30 = YES;
            _isButton40 = YES;
            _isButton50 = YES;
        }else{
            
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton20 = YES;
            
        }
        _j= 2;
        
    }else if (sender.tag ==102 ){
        
        if (_isButton30 ) {
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton10 = YES;
            _isButton20 = YES;
            _isButton30 = NO;
            _isButton40 = YES;
            _isButton50 = YES;
        }else{
            
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton30 = YES;
           
        }
        
        _j= 3;
        
    }else if (sender.tag ==103){
        
        if (_isButton40 ) {
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton10 = YES;
            _isButton20 = YES;
            _isButton30 = YES;
            _isButton40 = NO;
            _isButton50 = YES;
            
        }else{
            
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
           
            _isButton40 = YES;
            
        }
        
        
        _j= 4;
        
        
    }else if (sender.tag ==104){
        
        if (_isButton50) {
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton10 = YES;
            _isButton20 = YES;
            _isButton30 = YES;
            _isButton40 = YES;
            _isButton50 = NO;
        }else{
            
            [_button100 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button101 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button102 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button103 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button104 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton50 = YES;
        }
        _j= 5;
    }
     NSLog(@"%d",_j);
}


-(IBAction)confirmAction{
    
    NSString *prodQuality = [NSString stringWithFormat:@"%d",self.y];
    NSString *deliverySpeed = [NSString stringWithFormat:@"%d",self.i];
    NSString *serviceAttitude = [NSString stringWithFormat:@"%d",self.j];
    
//     if (isValid && self.passwordField.text != nil && ![self.passwordField.text isEqualToString:@""])
    
    if ((self.textField.text != nil && [self.textField.text isEqualToString:@""])) {
        
        [self showToastMessage:@"请给出您宝贵的评价，谢谢!"];
        
    }else{
    
    NSMutableArray *array = [[NSMutableArray alloc]initWithCapacity:1];
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    SetValueForKey(dic, self.myOrderModel.orderId, @"orderId");
    SetValueForKey(dic, self.myOrderItems.productId, @"productId");
    SetValueForKey(dic, prodQuality , @"prodQuality");
    SetValueForKey(dic, deliverySpeed , @"deliverySpeed");
    SetValueForKey(dic, serviceAttitude , @"serviceAttitude");
    SetValueForKey(dic, self.textField.text, @"evaluateContent");
        [array addObject:dic];
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    SetValueForKey(params, [RegisterHelper shareHelper].userId, @"userId");
    SetValueForKey(params, array, @"prodEvaluates");

    [NetWorkService byRequestWithAPIPrefix:kBaseAppUrl
                              andAPISuffix:kOrderCreate
                             andHttpMethod:@"POST"
                             andParameters:params
                           andRequestCache:NO
                            andUseParamDic:YES
                       andPostDataEncoding:MKNKPostDataEncodingTypeJSON
                     andRequestFinishBlock:^(BYRequest *request, BYResponse *response) {
                         
                         if (response.isError) {
                             
                             DLog(@"error %@",response.errorMessage);
                             
                         }else{
                             
                             NSDictionary *responseDic = request.responseJSON;
                             DLog(@"成功数据:%@",responseDic);
                             [self.navigationController popViewControllerAnimated:YES];
                         }
                         }];
    }
}



//产品质量
-(IBAction)productAction:(UIButton *)sender{
    if (sender.tag == 200 ) {
        
        if (_isButton200 ) {
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton200 = NO;
            _isButton201 = YES;
            _isButton202 = YES;
            _isButton203 = YES;
            _isButton204 = YES;
            
        }else{
            
            [_button200 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton200 = YES;
            
        }
        
        _y= 1;
        
    }else if (sender.tag ==201){
        if (_isButton201 ) {
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton200 = YES;
            _isButton201 = NO;
            _isButton202 = YES;
            _isButton203 = YES;
            _isButton204 = YES;
        }else{
            
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton201 = YES;
           
        }
        _y= 2;
        
    }else if (sender.tag ==202 ){
        
        if (_isButton202 ) {
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton200 = YES;
            _isButton201 = YES;
            _isButton202 = NO;
            _isButton203 = YES;
            _isButton204 = YES;
        }else{
            
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            _isButton202 = YES;
            
        }
        
        _y= 3;
        
    }else if (sender.tag ==203){
        
        if (_isButton203 ) {
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton200 = YES;
            _isButton201 = YES;
            _isButton202 = YES;
            _isButton203 = NO;
            _isButton204 = YES;
            
        }else{
            
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton203 = YES;
        
        }
        
        
        _y= 4;
        
        
    }else if (sender.tag ==204){
        
        if (_isButton204) {
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            _isButton200 = YES;
            _isButton201 = YES;
            _isButton202 = YES;
            _isButton203 = YES;
            _isButton204 = NO;
        }else{
            
            [_button200 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button201 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button202 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button203 setImage:[UIImage imageNamed:@"star_select"] forState:UIControlStateNormal];
            [_button204 setImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
            
            
            _isButton204 = YES;
        }
        _y= 5;
    }
    NSLog(@"%d",_y);

}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    
    [textField resignFirstResponder];
    return YES;
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}


- (void)viewWillDisappear:(BOOL)animated
{
    
    [super viewWillDisappear:animated];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
